Z = fun(X) -> 2*X end.
Double = Z.
Doubleasd
Hypot = fun(X,Y) -> math:sqrt(X*X + Y*Y) end.

TempConvert = fun({c,C}) -> {f, 32 + C*9/5};
                 ({f,F}) -> {c, (F-32)*5/9}
              end.

L = [1,2,3,4].
lists:map(Double,L).

Even = fun(X) -> (X rem 2) =:= 0 end.

Fruit = [apple, pear, orange].
MakeTest = fun(L) -> (fun(X) -> lists:member(X,L) end) end.

IsFruit = MakeTest(Fruit).
IsFruit(dog).
IsFruit(apple).
lists:filter(IsFruit,[dog,orange,cat,apple,bear]).

Mult = fun(Times) -> ( fun(X) -> X * Times end ) end.
Triple = Mult(3).
Triple(5).

c(shop).
Buy = [{oranges,4},{newspaper,1},{apples,10},{pears,5},{milk,3}].
L1 = lists:map(fun({What,N}) -> shop:cost(What) * N end, Buy).
[{Name, 2*Number} || {Name, Number} <- Buy]

L=[1,2,3,4,5].
lists:map(fun(X) -> 2*X end, L).
[2*X || X <- L].
